<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:output method="xml" encoding="utf-8" />
	<xsl:template match="files">
		<documents>
			<xsl:variable name="documents"
				select="document(doc/@filename)/document" />
			<xsl:for-each select="$documents">
				<document>
					<xsl:apply-templates select="etno_prinadl" />
				</document>
			</xsl:for-each>
		</documents>
	</xsl:template>
	<xsl:template match="*">
		<xsl:copy>
			<xsl:for-each select="@*">
				<xsl:copy />
			</xsl:for-each>
			<xsl:apply-templates/>
		</xsl:copy>
	</xsl:template>
</xsl:stylesheet>
